package com.xja.wechat.controller;

import com.xja.wechat.common.JsonBean;
import com.xja.wechat.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("createOrder")
    public JsonBean createOrder(String openid) {

        return orderService.addOrder(openid);
    }

    @PostMapping("payOrder")
    public JsonBean payOrder(String orderNo, String openid) {

        return orderService.payOrder(orderNo, openid);
    }
}
